package com.live.stamp.base.validation;

import com.hikeSoft.common.utils.BaseUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.container.core.common.BusinessException;

/**
 * 字符串验证处理器
 */
public class BlankHandle extends ParamHandler {
    private static final Logger logger = LoggerFactory.getLogger(BlankHandle.class);

    @Override
    protected ValidationEnum getParamHandleType() {
        return ValidationEnum.BLANK;
    }

    @Override
    protected void echo(String paramName, Object param) {
        String p = (String)param;

        if(BaseUtils.isBlank(p)){
            logger.error("BlankHandle class -> param:{} of String is blank", paramName);
            throw new BusinessException(String.format("字符串%s为空", paramName));
        }
    }
}
